<?php

namespace app\modules\api\controllers;

use Yii;
use app\modules\api\models\Department;
use yii\data\ActiveDataProvider;
use yii\rest\ActiveController;
use yii\web\NotFoundHttpException;
use yii\web\ServerErrorHttpException;

/**
 * @OA\Tag(
 *   name="Department",
 *   description="部门管理",
 * )
 */
class DepartmentController extends ActiveController
{
    public $modelClass = 'app\modules\api\models\Department';

    /**
     * @OA\Post(
     *      path="/department/create",
     *      tags={"Group"},
     *      summary="部门 - 添加（ 接收表单提交 ）",
     *      @OA\RequestBody(
     *          @OA\MediaType(
     *              mediaType="multipart/form-data",
     *              @OA\Schema(
     *                  required={"groupId", "name", "type"},
     *                  @OA\Property(property="groupId", type="integer", description="组织ID"),
     *                  @OA\Property(property="parentId", type="integer", description="父级ID", default="0"),
     *                  @OA\Property(property="type", type="integer", description="部门类型（ 1：普通、2：销售 ）", enum={1, 2}),
     *                  @OA\Property(property="name", type="string", description="部门名称"),
     *                  @OA\Property(property="sort", type="integer", description="排序值", default="0"),
     *             )
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionCreate()
    {
    }

    /**
     * @OA\Post(
     *      path="/department/update",
     *      tags={"Group"},
     *      summary="部门 - 编辑（ 接收表单提交 ）",
     *      @OA\Parameter(
     *          name="id",
     *          in="query",
     *          description="部门ID",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *          ),
     *      ),
     *      @OA\RequestBody(
     *          @OA\MediaType(
     *              mediaType="multipart/form-data",
     *              @OA\Schema(
     *                  required={"name", "type"},
     *                  @OA\Property(property="name", type="string", description="部门名称"),
     *                  @OA\Property(property="type", type="integer", description="部门类型（ 1：普通、2：销售 ）", enum={1, 2}),
     *                  @OA\Property(property="sort", type="integer", description="排序值", default="0"),
     *              )
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionUpdate()
    {

    }

    /**
     * @OA\POST(
     *      path="/department/delete",
     *      summary="部门 - 删除（ 接收表单提交 ）",
     *      tags={"Group"},
     *      @OA\Parameter(
     *          description="部门ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionDelete()
    {

    }

    /**
     * @OA\Get(
     *      path="/department/get-drop-list",
     *      summary="部门 - 下拉数据列表 （ 添加、编辑时调用 ）",
     *      tags={"Department"},
     *      @OA\Parameter(
     *          description="组织ID",
     *          in="query",
     *          name="groupId",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="技术部", description="部门名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="部门ID"),
     *                      ),
     *                  ),
     *                  example={"name":"技术部", "id": 1}
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetDropList()
    {

    }

    /**
     * @OA\Get(
     *      path="/department/get-info",
     *      tags={"Department"},
     *      summary="部门 - 编辑时的信息（ 编辑时调用 ）",
     *      @OA\Parameter(
     *          name="id",
     *          in="query",
     *          description="部门ID",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *          ),
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="list",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="技术部", description="部门名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="部门ID"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="group",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="晟田集团", description="组织名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="组织ID"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="department",
     *                      type="object",
     *                      @OA\Property(property="id", type="integer", example="2", description="主键"),
     *                      @OA\Property(property="groupId", type="integer", example="1", description="组织ID"),
     *                      @OA\Property(property="parentId", type="integer", example="1", description="上级ID"),
     *                      @OA\Property(property="name", type="string", example="技术部", description="部门名称"),
     *                      @OA\Property(property="type", type="integer", example="1", description="部门类型"),
     *                      @OA\Property(property="sort", type="integer", example="0", description="排序值"),
     *                  ),
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetInfo(){

    }
}
